<template>
  <div class="sidebar">
    <el-menu
        class="sidebar-el-menu"
        :default-active="onRoutes"
        :collapse="collapse"
        background-color="#334256"
        text-color="#fff"
        active-text-color="#20a0ff"
        router
    >
      <template v-for="item in items">
        <el-menu-item :index="item.index" :key="item.index">
          <i :class="item.icon"></i>{{item.title}}
        </el-menu-item>
      </template>
    </el-menu>
  </div>
</template>

<script>
export default {
name: "Aside",
  data(){
  return {
    collapse: false,
    items: [
      {icon: 'el-icon-menu', index: 'Info', title: '系统首页'},
      {icon: 'el-icon-user', index: 'User', title: '用户管理'},
      {icon: 'el-icon-user', index: 'Singer', title: '歌手管理'},
      {icon: 'el-icon-headset', index: 'Song', title: '歌单管理'}
    ]
  }
  },
  computed:{
    onRoutes(){
      return this.$route.path.replace('/','');
    }
  },
}
</script>

<style scoped>
.sidebar{
  width: 220px;
  text-align: center;
  display: block;
  position: absolute;
  left: 0;
  top: 70px;
  bottom: 0;
  background-color: #334256;
  overflow: auto;
}

</style>
